/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package main_frame;

import common.SystemVariyable;
import common.util.HibernateUtil;
import java.awt.Dimension;
import static java.awt.Frame.MAXIMIZED_BOTH;
import java.awt.event.MouseEvent;
import javax.swing.JInternalFrame;
import master.committee.REGCommittee;
import master.member.REGMember;
import master.privilage.REGPrivilage;
import master.year.REGYear;
import report.batch_list.REPBatchMembersAddressList;
import report.committeeMembersAddressList.REPCommitteeMembersAddressList;
import report.letter.members.REPMembersAddressListLetter;
import report.letter.committee.REPCommitteeAddressListLetter;
import report.name_list.REPNameList;
import transaction.add_committee.REGAddCommittee;
import transaction.add_donation.REGDonation;
import transaction.committee_management.REGCommitteeManager;
import transaction.member_management.REGMemberManager;
import transaction.member_search.REGMemberSearch;

/**
 *
 * @author User
 */
public class MainFrame extends javax.swing.JFrame {

    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        initComponents();
        initOthers();
    }

    private void loadFrame(JInternalFrame fc) {
        fc.setBounds(jDesktopPane1.getWidth() / 2 - fc.getWidth() / 2, jDesktopPane1.getHeight() / 2 - fc.getHeight() / 2, fc.getWidth(), fc.getHeight());
        jDesktopPane1.add(fc);
        fc.setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private void initOthers() {
        this.setSize(800, 500);
        this.setExtendedState(MAXIMIZED_BOTH);
        this.setResizable(true);
//        mainThread();
        SystemVariyable.session = HibernateUtil.getSessionFactory().openSession();
//        Dimension iconInitDemention = new Dimension(200, 200);
//        jLabel2.setIcon(zsystem.Resource.getResizableLogo(zsystem.Resource.LOGO, iconInitDemention));
        //jLabel2.revalidate();
        //jLabel2.repaint();
        jLabel3.setText(
                "<html>"
                + " <p>"
                + "     <center>"
                + "     <b>"
                + "         OBA Vidiyartha collage</b>"
                + "         <br/>Kandy"
                + "     </center>"
                + " </p>"
                + "</html>");
        jDesktopPane1.revalidate();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pm = new javax.swing.JPopupMenu();
        member = new javax.swing.JMenu();
        mnuMember = new javax.swing.JMenuItem();
        mnuMemberManager = new javax.swing.JMenuItem();
        mnuMemberSearch = new javax.swing.JMenuItem();
        committee = new javax.swing.JMenu();
        mnuPrivilage = new javax.swing.JMenuItem();
        mnuYear = new javax.swing.JMenuItem();
        mnuCommittee = new javax.swing.JMenuItem();
        mnuAddCommittee = new javax.swing.JMenuItem();
        mnuCommitteeManager = new javax.swing.JMenuItem();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        btnMember = new javax.swing.JButton();
        btnCommittee = new javax.swing.JButton();
        btnCommittee1 = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem14 = new javax.swing.JMenuItem();

        member.setText("jMenu4");

        mnuMember.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuMember.setForeground(new java.awt.Color(0, 0, 51));
        mnuMember.setText("Add New Member");
        mnuMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMemberActionPerformed(evt);
            }
        });
        member.add(mnuMember);

        mnuMemberManager.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuMemberManager.setForeground(new java.awt.Color(0, 0, 51));
        mnuMemberManager.setText("Member Manage");
        mnuMemberManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMemberManagerActionPerformed(evt);
            }
        });
        member.add(mnuMemberManager);

        mnuMemberSearch.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuMemberSearch.setForeground(new java.awt.Color(0, 0, 51));
        mnuMemberSearch.setText("Member Search");
        mnuMemberSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMemberSearchActionPerformed(evt);
            }
        });
        member.add(mnuMemberSearch);

        committee.setText("jMenu4");

        mnuPrivilage.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuPrivilage.setForeground(new java.awt.Color(0, 0, 51));
        mnuPrivilage.setText("Privilages");
        mnuPrivilage.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuPrivilageActionPerformed(evt);
            }
        });
        committee.add(mnuPrivilage);

        mnuYear.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuYear.setForeground(new java.awt.Color(0, 0, 51));
        mnuYear.setText("Add Year");
        mnuYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuYearActionPerformed(evt);
            }
        });
        committee.add(mnuYear);

        mnuCommittee.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuCommittee.setForeground(new java.awt.Color(0, 0, 51));
        mnuCommittee.setText("Creat Committee");
        mnuCommittee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuCommitteeActionPerformed(evt);
            }
        });
        committee.add(mnuCommittee);

        mnuAddCommittee.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuAddCommittee.setForeground(new java.awt.Color(0, 0, 51));
        mnuAddCommittee.setText("Add Committee Members");
        mnuAddCommittee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuAddCommitteeActionPerformed(evt);
            }
        });
        committee.add(mnuAddCommittee);

        mnuCommitteeManager.setFont(new java.awt.Font("Segoe UI", 1, 11)); // NOI18N
        mnuCommitteeManager.setForeground(new java.awt.Color(0, 0, 51));
        mnuCommitteeManager.setText("Manage Committee");
        mnuCommitteeManager.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuCommitteeManagerActionPerformed(evt);
            }
        });
        committee.add(mnuCommitteeManager);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(204, 204, 204));
        setMinimumSize(new java.awt.Dimension(915, 540));

        jDesktopPane1.setBackground(new java.awt.Color(255, 255, 255));
        jDesktopPane1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jDesktopPane1.setForeground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1);
        jDesktopPane1.setLayout(jDesktopPane1Layout);
        jDesktopPane1Layout.setHorizontalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jDesktopPane1Layout.setVerticalGroup(
            jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("User : Roshan");
        jLabel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zresources/icons/system/Logo.png"))); // NOI18N
        jLabel2.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jLabel2.setOpaque(true);

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("jLabel3");
        jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("Year : 14-15");
        jLabel4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setText("Date : 2015/01/25");
        jLabel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel6.setText("Last Update : 2015/01/25");
        jLabel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jToolBar1.setBorder(null);
        jToolBar1.setFloatable(false);
        jToolBar1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jToolBar1.setRollover(true);
        jToolBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jToolBar1.setOpaque(false);

        btnMember.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnMember.setForeground(new java.awt.Color(255, 153, 0));
        btnMember.setText("Member");
        btnMember.setToolTipText("");
        btnMember.setAutoscrolls(true);
        btnMember.setFocusable(false);
        btnMember.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        btnMember.setMargin(new java.awt.Insets(5, 14, 5, 14));
        btnMember.setMaximumSize(new java.awt.Dimension(520, 50));
        btnMember.setMinimumSize(new java.awt.Dimension(520, 50));
        btnMember.setPreferredSize(new java.awt.Dimension(520, 50));
        btnMember.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnMemberMouseClicked(evt);
            }
        });
        btnMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMemberActionPerformed(evt);
            }
        });
        jToolBar1.add(btnMember);

        btnCommittee.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnCommittee.setForeground(new java.awt.Color(255, 153, 0));
        btnCommittee.setText("Committee");
        btnCommittee.setToolTipText("Committee");
        btnCommittee.setAutoscrolls(true);
        btnCommittee.setFocusable(false);
        btnCommittee.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        btnCommittee.setMargin(new java.awt.Insets(5, 14, 5, 14));
        btnCommittee.setMaximumSize(new java.awt.Dimension(520, 50));
        btnCommittee.setMinimumSize(new java.awt.Dimension(520, 50));
        btnCommittee.setPreferredSize(new java.awt.Dimension(520, 50));
        btnCommittee.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCommitteeMouseClicked(evt);
            }
        });
        btnCommittee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCommitteeActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCommittee);

        btnCommittee1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btnCommittee1.setForeground(new java.awt.Color(255, 153, 0));
        btnCommittee1.setText("Report");
        btnCommittee1.setToolTipText("Report");
        btnCommittee1.setAutoscrolls(true);
        btnCommittee1.setFocusable(false);
        btnCommittee1.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
        btnCommittee1.setMargin(new java.awt.Insets(5, 14, 5, 14));
        btnCommittee1.setMaximumSize(new java.awt.Dimension(520, 50));
        btnCommittee1.setMinimumSize(new java.awt.Dimension(520, 50));
        btnCommittee1.setPreferredSize(new java.awt.Dimension(520, 50));
        btnCommittee1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCommittee1MouseClicked(evt);
            }
        });
        btnCommittee1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCommittee1ActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCommittee1);

        jPanel1.add(jToolBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 11, 190, 200));
        jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 240));

        jMenu1.setText("File");

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem4.setText("Exit");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        jMenu4.setText("Member");
        jMenu4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu4ActionPerformed(evt);
            }
        });

        jMenuItem5.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem5.setText("Add New Member");
        jMenu4.add(jMenuItem5);

        jMenuItem6.setText("Member Manage");
        jMenu4.add(jMenuItem6);

        jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem7.setText("Member Search");
        jMenu4.add(jMenuItem7);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("Committee");

        jMenuItem9.setText("Add Privilage");
        jMenu5.add(jMenuItem9);

        jMenuItem10.setText("Add Year");
        jMenu5.add(jMenuItem10);

        jMenuItem12.setText("Creat Committee");
        jMenu5.add(jMenuItem12);

        jMenuItem8.setText("Add Committee");
        jMenu5.add(jMenuItem8);

        jMenuItem11.setText("Committee Manage");
        jMenu5.add(jMenuItem11);

        jMenuBar1.add(jMenu5);

        jMenu3.setText("Reports");
        jMenu3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu3ActionPerformed(evt);
            }
        });

        jMenuItem1.setText("Address List of Batch");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem1);

        jMenuItem2.setText("Address List of Committee");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem2);

        jMenuItem3.setText("Name List of Members");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem3);

        jMenuItem13.setText("Address List for Letters");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem13);

        jMenuItem14.setText("Address List for Letters (Committee)");
        jMenuItem14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem14ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem14);

        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jDesktopPane1))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jDesktopPane1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 228, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        REPCommitteeMembersAddressList frame = new REPCommitteeMembersAddressList();
        loadFrame(frame);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        REPBatchMembersAddressList frame = new REPBatchMembersAddressList();
        loadFrame(frame);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed

    }//GEN-LAST:event_jMenu3ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        REPNameList frame = new REPNameList();
        loadFrame(frame);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void mnuMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMemberActionPerformed
        REGMember frame = new REGMember();
        loadFrame(frame);
    }//GEN-LAST:event_mnuMemberActionPerformed

    private void mnuPrivilageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuPrivilageActionPerformed
        REGPrivilage frame = new REGPrivilage();
        loadFrame(frame);
    }//GEN-LAST:event_mnuPrivilageActionPerformed

    private void mnuYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuYearActionPerformed
        REGYear frame = new REGYear();
        loadFrame(frame);
    }//GEN-LAST:event_mnuYearActionPerformed

    private void mnuCommitteeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCommitteeActionPerformed
        REGCommittee frame = new REGCommittee();
        loadFrame(frame);
    }//GEN-LAST:event_mnuCommitteeActionPerformed

    private void mnuAddCommitteeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAddCommitteeActionPerformed
        REGAddCommittee frame = new REGAddCommittee();
        loadFrame(frame);
    }//GEN-LAST:event_mnuAddCommitteeActionPerformed

    private void mnuCommitteeManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCommitteeManagerActionPerformed
        REGCommitteeManager frame = new REGCommitteeManager();
        loadFrame(frame);
    }//GEN-LAST:event_mnuCommitteeManagerActionPerformed

    private void mnuMemberManagerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMemberManagerActionPerformed
        REGMemberManager frame = new REGMemberManager();
        loadFrame(frame);
    }//GEN-LAST:event_mnuMemberManagerActionPerformed

    private void btnCommitteeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCommitteeActionPerformed

    }//GEN-LAST:event_btnCommitteeActionPerformed

    private void btnCommitteeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCommitteeMouseClicked
        loadCommitteeMenu(evt);
    }//GEN-LAST:event_btnCommitteeMouseClicked

    private void btnMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMemberActionPerformed

    }//GEN-LAST:event_btnMemberActionPerformed

    private void btnMemberMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnMemberMouseClicked
        loadMemberMenu(evt);
    }//GEN-LAST:event_btnMemberMouseClicked

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        System.exit(1);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void btnCommittee1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCommittee1MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_btnCommittee1MouseClicked

    private void btnCommittee1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCommittee1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnCommittee1ActionPerformed

    private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu4ActionPerformed

    private void mnuMemberSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMemberSearchActionPerformed
        REGMemberSearch frame = new REGMemberSearch();
        loadFrame(frame);
    }//GEN-LAST:event_mnuMemberSearchActionPerformed

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
        REPMembersAddressListLetter frame = new REPMembersAddressListLetter();
        loadFrame(frame);
    }//GEN-LAST:event_jMenuItem13ActionPerformed

    private void jMenuItem14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem14ActionPerformed
        REPCommitteeAddressListLetter frame = new REPCommitteeAddressListLetter();
        loadFrame(frame);
    }//GEN-LAST:event_jMenuItem14ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCommittee;
    private javax.swing.JButton btnCommittee1;
    private javax.swing.JButton btnMember;
    private javax.swing.JMenu committee;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JMenu member;
    private javax.swing.JMenuItem mnuAddCommittee;
    private javax.swing.JMenuItem mnuCommittee;
    private javax.swing.JMenuItem mnuCommitteeManager;
    private javax.swing.JMenuItem mnuMember;
    private javax.swing.JMenuItem mnuMemberManager;
    private javax.swing.JMenuItem mnuMemberSearch;
    private javax.swing.JMenuItem mnuPrivilage;
    private javax.swing.JMenuItem mnuYear;
    private javax.swing.JPopupMenu pm;
    // End of variables declaration//GEN-END:variables
    public static int f = 0;
    public static Object val = "";

    private void loadMemberMenu(MouseEvent evt) {
        pm.removeAll();
        pm.add(mnuMember);
        pm.add(mnuMemberManager);
        pm.add(mnuMemberSearch);

        pm.show(evt.getComponent(), 195, 0);
    }

    private void loadCommitteeMenu(MouseEvent evt) {
        pm.removeAll();
        pm.add(mnuPrivilage);
        pm.add(mnuYear);
        pm.add(mnuCommittee);
        pm.add(mnuAddCommittee);
        pm.add(mnuCommitteeManager);

        pm.show(evt.getComponent(), 195, 0);
    }

    private void mainThread() {
        new Thread(new Runnable() {

            @Override
            public void run() {
                while (true) {
                    try {
                        System.out.println("2222");
                        if (f == 1) {
                        System.out.println("3333");
                            loadDonation(val);
                            val = "";
                            f = 0;
                        }
                    } catch (Exception ex) {

                    }
                }
            }

        }).start();
    }

    private void loadDonation(Object val) {
        REGDonation frame = new REGDonation(val);
        loadFrame(frame);
    }
}
